package andanyoung.springcloud.user.client.fallback;

import andanyoung.springcloud.user.client.OrderClient;
import org.springframework.stereotype.Component;

/**
 * 要使类提供降级方法，需要满足3个条件：
 * 1. 实现OpenFeign接口定义的方法
 * 2. 将Bean注册为Spring Bean
 * 3. 使用@FeignClient的fallback配置项指向当前类 *
 */
@Component
public class OrderFallback implements OrderClient {
    @Override
    public String getOrder(long uid) {
        return "降级服务 getOrder - UID:" + uid;
    }

    @Override
    public String getFailureOrder(long uid) {
        return "降级服务 getFailureOrder - UID:" + uid;
    }
}
